<?php
/**
 * @deprecated - 功能暂时取消
 * 返回 customer 的所有2.5d发型试戴的素材
 *
 * Author: lyun
 * Date: 2018/5/10
 * Created by Panxsoft.
 */


namespace App\Http\Controllers\App;

use App\Http\Controllers\ApiController;
use App\Http\Requests\App\HairAssetRequest;
use App\Models\Customer\Customer;
use App\Models\Customer\HairAsset;

class HairAssetController extends ApiController
{

    /**
     * 返回hair_assets 表中当前客户下的所有 assets_dir
     *
     * @param HairAssetRequest $request
     * @return array|\Illuminate\Http\Response
     * @throws \Exception
     */
    public function getHairAsset(HairAssetRequest $request)
    {
        $customer = Customer::find($request->customer_id);
            $this->checkItemExist($customer, trans('app.customer_error'));

        $hair_assets = HairAsset::where('customer_id', $customer->id)
            ->orderBy('sort', 'DESC')
            ->orderBy('id', 'DESC')
            ->get();

        return $this->response(compact('hair_assets'));
    }
}
